const Router = require('koa-router')
const router = new Router()
const home = require('../controller/home')
const course = require('../controller/course')
const elastic = require('../controller/elastic')
const auth = require('../controller/auth')
const site = require('../controller/site')

router.get('/', home)

router.get('/api/courses', elastic.list)
router.get('/api/recomms', elastic.recomms)
router.post('/api/recomm', course.save)
router.post('/api/feedback', site.saveFeedback)
router.post('/login', auth.login)
router.post('/logout', auth.logout)
router.put('/api/course/hit', elastic.hit)
router.put('/api/course/bookmark', auth.authUser, elastic.bookmark)
router.put('/api/course/share', elastic.share)

module.exports = router